﻿@{
    ViewBag.Title = "";
    var id = Model != null ? Model.ID : 0;
    var infoCollectItemName = Model != null ? Model.InsuranceProductsInfoCollectItem.InfoCollectItemName : "";
}
@using ZBJF.Warranty.Common.Enums.InfoCollect
@using ZBJF.Warranty.Common.Enums.InsuranceProducts
@using ZBJF.Warranty.WebProvider
@model ZBJF.Warranty.Model.CollectTypeCollectItemMappings
<ul class="nav nav-tabs">
    <li><a href="/CollectTypeCollectItemMappings/">信息收集配置</a></li>
    <li class="active"><a href="/CollectTypeCollectItemMappings/Edit/@id">@(id > 0 ? "编辑信息收集配置" : "添加信息收集配置")</a></li>
</ul>
@using (Html.BeginForm("Save", "CollectTypeCollectItemMappings", FormMethod.Post, new { id = "mvcForm", name = "mvcForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    <div class="control-group">
        <label class="control-label">所属信息收集方(类别):</label>
        <div class="controls">
            @Html.DropDownListFor(m => m.CollectWithType, ConvertToSelector.Instance.EnumTypeConvertToSelectList(typeof(CollectWithType)), new { validate = "{required:true,messages:{required:'请选择所属信息收集类别'}}" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">信息收集项目:</label>
        <div class="controls">
            @Html.TextBox("InfoCollectItemName", infoCollectItemName, new { validate = "{required:true,messages:{required:'请选择信息收集项目'}}", @readonly = "readonly", @class = "select-icon", onclick = "showInfoCollectItemLayer()" })
            @Html.HiddenFor(m => m.CollectItemID)
        </div>
    </div>
    <div class="form-actions">
        <input class="btn form-reset" type="button" value="重置">
        <input id="btnSubmit" class="btn btn-primary Edit-R" onclick="layer.load()" type="submit" value="保存">
    </div>
}
@section scripts
{
    <script type="text/javascript">
       function showInfoCollectItemLayer() {
            layer.open({
                type: 2,
                title: '请选择信息收集项目',
                shadeClose: true,
                shade: 0.8,
                area: ['820px', '75%'],
                content: '/PubModelDialog/InfoCollectItemSelector' //iframe的url
            });
        }
        //选中客户后设置值,清空选中的配件
       function setSelectItem(item) {
            if (!item || item == "") {
                $("#CollectItemID").val("");
                $("#InfoCollectItemName").val("");
            } else {
                $("#CollectItemID").val(item[0].ID);
                $("#InfoCollectItemName").val(item[0].InfoCollectItemName);
            }

        }
    </script>
}
